home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c1.zip / ISCHECK.C < prev    next >
Text File  |  1987-06-18  |  2KB  |  51 lines

  1.  
  2. /* ischeck()  program to check Microsoft C's issomething matrix.
  3.  *            it has no other purpose.
  4.  *            1 to 1 correspondence between 0 to 127 and 128 to 255!!!
  5.  *            WHRauser   10-4-83     Microsoft C  Version 1.04
  6.  */
  7.  
  8. #include  <ctype.h>
  9.  
  10. main()
  11. {
  12.      int  i;
  13.  
  14.      printf("   dec   char   hex    XBCP SNLU    ");
  15.      printf("   dec   char   hex    XBCP SNLU\n\n");
  16.  
  17.      for (i=0; i<128; i++) {
  18.           printit(i);
  19.           printit(i+128);
  20.           printf("\n");
  21.      }
  22. }/*main
  23. --------------------------------------------*/
  24.  
  25. printit(i)
  26.      int i;
  27. {
  28.      int  t;
  29.      int  alpha;
  30.      int  x,b,c,p, s,n,l,u;     /* bit map */
  31.  
  32.      if isprint(i)
  33.            alpha = i;
  34.      else  alpha = ' ';
  35.  
  36.      t = _ctype[i+1];    /*Stupid, don't they know C is zero origin?*/
  37.  
  38.      x = t & 128 ? 1 : 0;    /*   X 128        hexadecimal flag */
  39.      b = t &  64 ? 1 : 0;    /*   B 64         blank flag */
  40.      c = t &  32 ? 1 : 0;    /*   C 32         control character flag */
  41.      p = t &  16 ? 1 : 0;    /*   P 16         punctuation flag */
  42.      s = t &   8 ? 1 : 0;    /*   S 8          space flag */
  43.      n = t &   4 ? 1 : 0;    /*   N 4          number flag */
  44.      l = t &   2 ? 1 : 0;    /*   L 2          lower case flag */
  45.      u = t &   1 ? 1 : 0;    /*   U 1          upper case flag */
  46.  
  47.      printf("  %3d     %c    %3x     %1d%1d%1d%1d %1d%1d%1d%1d    ",
  48.              i,alpha,t, x,b,c,p, s,n,l,u);
  49. }
  50.  
  51.